package close.mazegame.entity;

import close.mazegame.art.MiscArt;
import close.mazegame.level.Level;
import close.mazegame.screens.Screen;

import com.badlogic.gdx.graphics.g2d.TextureRegion;

public abstract class Entity {

	protected Level level;
	protected TextureRegion mainTexture;
	protected boolean remove = false;

	public Entity(Level level) {
		this.level = level;
		mainTexture = MiscArt.voidTile;
	}

	public abstract float getXSize();

	public abstract float getYSize();

	public void remove() {
		remove = true;
	}

	public boolean isRemoved() {
		return remove;
	}

	public abstract void dispose();

	public abstract float getX();

	public abstract float getY();

	public abstract float getAngle(); // In radians

	public void render(Screen screen) {
		float x = getX() - getXSize() / 2;
		float y = getY() - getYSize() / 2;
		float ang = (float) Math.toDegrees(getAngle());
		screen.draw(mainTexture, x, y, getXSize(), getYSize(), ang);
	}

	public abstract void update(float delta);

	public Level getLevel() {
		return level;
	}
}
